<template>
  <div class="container">
  
        <van-form class="btn-list" @submit="onSubmit">
      <van-field 
      name='sss'
        required
        v-model="phone"
        center
        clearable
        placeholder="请输入手机号码"
        :rules="rule"
      >
      </van-field>
      <van-button type="info"   >填写申请</van-button>
      <van-button type="info" native-type="button" @click="btnHandler2"  >查询申请</van-button>
      </van-form>
    
  </div>
</template>

<script>
import { getAxios2 } from "@/utils/request2";
export default {
  data() {
    return {
      btnList: [
        { title: "信息填写", itemCode: 1 },
        { title: "提交记录", itemCode: 2 },
      ],
      phone: "",
      rule:[
          { required: true, message: "请输入联系电话", trigger: "blur" },
          { pattern: /^1[3456789]\d{9}$/, message: '手机号码格式错误！'}
        ],
    };
  },
  mounted() {
 
  },
  created() {},
  methods: {
    onSubmit(value){
        this.$router.push({ path: "/CPNS/info", query: { ApplicantMobile:this.phone } });
    },
    btnHandler2() {
     var regExp = /^1[3456789]\d{9}$/;
    if (regExp.test(this.phone)) {
        this.$router.push({ path: "/CPNS/List", query: { mobile:this.phone } });
    } else {
        this.$toast("请填写有效手机号")
    }

    },
  },
};
</script>

<style lang="less" scoped>
.container {
  .btn-list {
    width: 90%;
    height: 430px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    margin: 15px;
    background-color: #D5EBF1;
    border-radius: 10px;
    box-shadow: 0 0 5px #ccc;
    padding-top: 78px;
    padding-bottom: 99px;
    padding-left: 20px;
    padding-right: 20px;
    .btn {
      padding: 10px 15px;

      .van-button {
        width: 100%;
        background-color: #f8f8f8;
      }
    }
  }
}
</style>